*****
*****
***     This SAS run uses the April 18, 2005
***     release of the 2004 ANES.
*****
*****
;
filename in "INSERT PATH TO DATASET\nes04dat.txt";
libname out "INSERT PATH TO SAS LIBRARY";
options linesize = 72;

data nes04;
infile in lrecl = 3307 firstobs = 2;
input caseid 34-37
   bush 812-814  kerry 816-818  nader 820-822
   cheney 824-826 edwards 828-830 lbush 832-834
   hclinton 836-838  bclinton 840-842  powell 844-846
   ashcroft 848-850  mccain 852-854  dempty 856-858
   reppty 860-862 
;

nthmiss = 0;
array thmiss bush reppty;
   do over thmiss;
   if thmiss > 100 then thmiss = .;
   if thmiss = . then nthmiss + 1;
   end;

if nthmiss > 0 then delete;

run;

data out.therms;
set nes04;
keep bush--reppty;
run;

